<?php
/**
* Class ListMain_Project_device_slider into Bo Controller
* @author SillySmart
* @copyright SillySmart
* @package Mvc.Controllers.Bo
* @see Mvc.Controllers.Bo.ControllerProtected
* @see Mvc.Controllers.SiteProtected
* @see Sls.Controllers.Core.SLS_GenericController
* @since 1.0
*
*/
class BoListMain_Project_device_slider extends BoControllerProtected
{
	public function init()
	{
		parent::init();
	}

	public function action()
	{
		// Params
		$arrayFilters = array(0 => array("column" => "project_device_slider_id", "description" => ""),
		                      1 => array("column" => "project_id", "description" => ""),
		                      2 => array("column" => "project_device_slider_img", "description" => ""),
		                      3 => array("column" => "project_device_slider_type", "description" => ""));
		$arrayColumns = array(0 => array("column" => "project_device_slider_id", "description" => ""),
		                      1 => array("column" => "project_id", "description" => ""),
		                      2 => array("column" => "project_device_slider_img", "description" => ""),
		                      3 => array("column" => "project_device_slider_type", "description" => ""));
		// /Params
		
		// Check account rights
		$right = SLS_BoRights::isAuthorized("read","Main_Project_device_slider",$this->_generic->getActionId());
		if ($right != 1)
			$this->_generic->redirect("Bo/Connection.sls");
		// /Check account rights
		
		$boListing = new SLS_BoListing($this,"project_device_slider","main");
		$boListing->setCurrentUrl("Bo","ListMain_Project_device_slider");
		$boListing->setAllowedFilters($arrayFilters);
		$boListing->setColumnsToShow($arrayColumns);
		$boListing->setDefaultLimit("0","20");
		if (SLS_BoRights::boActionExist("main","project_device_slider","Delete") && SLS_BoRights::isAuthorized("delete","Main_Project_device_slider"))
			$boListing->addActionDelete("Bo","DeleteMain_Project_device_slider");
		if (SLS_BoRights::boActionExist("main","project_device_slider","Modify") && SLS_BoRights::isAuthorized("edit","Main_Project_device_slider"))
			$boListing->addActionModify("Bo","ModifyMain_Project_device_slider");
		if (SLS_BoRights::boActionExist("main","project_device_slider","Add") && SLS_BoRights::isAuthorized("add","Main_Project_device_slider"))
			$boListing->addActionAdd("Bo","AddMain_Project_device_slider");
		if (SLS_BoRights::boActionExist("main","project_device_slider","Clone") && SLS_BoRights::isAuthorized("clone","Main_Project_device_slider"))
			$boListing->addActionClone("Bo","CloneMain_Project_device_slider");
		if (SLS_BoRights::boActionExist("main","project_device_slider","Email") && SLS_BoRights::isAuthorized("email","Main_Project_device_slider"))
			$boListing->addActionEmail("Bo","EmailMain_Project_device_slider");
		$boListing->constructList();
		$xml = $this->getXML();
		$boActions = SLS_BoRights::getDistinctActions();
		$xml->startTag("bo_actions");
		for($i=0 ; $i<$count=count($boActions) ; $i++)
		{
			$xml->startTag("bo_action");
			foreach($boActions[$i] as $key => $value)
				$xml->addFullTag($key,$value,true);
			$xml->endTag("bo_action");
		}
		$xml->endTag("bo_actions");

		// Export
		$http = $this->_generic->getObjectHttpRequest();
		$controllersXML = $this->_generic->getControllersXML();
		$controller = array_shift($controllersXML->getTags("//controllers/controller[@isBo='true']/@name"));
		$controllers = $this->_generic->getTranslatedController($controller,"Export");
		$column = ($http->getParam("column") == "") ? "|sls_empty|" : $http->getParam("column");
		$order = ($http->getParam("order") == "") ? "|sls_empty|" : $http->getParam("order");
		$group_filter = ($http->getParam("group_filter") == "") ? "|sls_empty|" : $http->getParam("group_filter");
		$queryString = $controllers["protocol"]."://".$this->_generic->getSiteConfig("domainName")."/".$controllers["controller"]."/".$controllers["scontroller"]."/column/".$column."/order/".$order;
		foreach($http->getParams() as $key => $value)
			if (SLS_String::startsWith($key,"filter_"))
			{
				if (empty($value))
					$value = "|sls_empty|";
				$queryString .= "/".$key."/".$value;
			}
		for($i=0 ; $i<$count=count($arrayColumns) ; $i++)
			$queryString .= "/Export_Column_".$i."/".$arrayColumns[$i]["column"];
		$queryString .= "/Export_Model/project_device_slider/Export_Db/main";
		$xml->addFullTag("url_export",$queryString,true);
		// /Export

		// Referrer
		$http = $this->_generic->getObjectHttpRequest();
		$params = $http->getParams();
		$strPost = "";
		foreach($params as $key => $value)
			if ($key != "mode" && $key != "smode" && !empty($value))
				$strPost .= $key."/".$value."/";
		$this->_generic->getObjectSession()->setParam("SLS_PREVIOUS_POST_ListMain_Project_device_slider",$strPost);
		// /Referrer

		$this->saveXML($xml);
	}
}
?>